import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

//2. 定义路由
// 每个路由应该映射一个组件。 其中"component" 可以是
// 通过 Vue.extend() 创建的组件构造器，
// 或者，只是一个组件配置对象。
const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('../views/HomePage.vue'),
    meta:{
      title:"首页"
    }
  },
  {
    path: '/vueLearnNote',
    name: 'vueLearnNote',
    component: () => import('../views/vueLearnNote.vue'),
    meta:{
      title:"学习vue router"
    }
  },
  {
    path: '/writeNote',
    name: 'writeNote',
    component: () => import('../views/writeNote.vue'),
    meta:{
      title:"编写学习笔记"
    }
  },
  {
    path: '/threeJsLearn',
    name: 'threeJsLearn',
    component: () => import('../views/threeJsLearn.vue'),
    meta:{
      title:"threeJs学习使用"
    }
  },
  {
    path: '/calendar',
    name: 'calendar',
    component: () => import('../views/calendar.vue'),
    meta:{
      title:"日历"
    }
  },
]

// 3. 创建 router 实例，然后传 `routes` 配置
const router = new VueRouter({
  mode: 'history',
  routes:routes
})

export default router
